package com.kehutong.repair.dto;

import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;

import java.time.LocalDateTime;
import java.util.Objects;

public abstract class KhtEntity extends Entity {

    private static final long serialVersionUID = -2405470600238017791L;

    protected KhtEntity(String id) {
        super(id);
    }

    @Column(comment="企业编号")
    private String companyNo;

    @Column(length=64, comment="企业名称")
    private String companyName;

    @Column(comment="逻辑删除")
    private boolean deleted;

    public String getCompanyNo() {
        return companyNo;
    }

    public void setCompanyNo(String companyNo) {
        this.companyNo = companyNo;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public boolean isDeleted() {
        return deleted;
    }

    public void setDeleted(boolean deleted) {
        this.deleted = deleted;
    }

    /**
     * <pre>时间是否有效</pre>
     * @param localDateTime
     * @return
     */
    protected boolean valid(LocalDateTime localDateTime) {
        if (Objects.isNull(localDateTime)) {
            return false;
        }

        return localDateTime.isAfter(LocalDateTime.now());
    }

}
